package day13.Homework;

import java.io.Serializable;
import java.text.DecimalFormat;
import java.util.Scanner;

//c.设计一个用户对象包含(手机号码(String),姓名(String),密码(String),
// 套餐对象,消费金额(double),当前余额(double),真实通话时长(int),真实短信条数(int),
// 真实使用流量(int)) 要求对类进行封装
public class User implements Serializable {
    private String phone;    //电话
    private String name;     //姓名
    private String password; //密码
    private Plan plan;       //套餐
    private double money;    //消费金额
    private double balance;  //当前余额
    private int callTime;    //通话时间
    private int message;     //短信条数
    private int realFlow;    //真实的流量

    public User(String phone, String name, String password, Plan plan, double money, double balance) {
        this.phone = phone;
        this.name = name;
        this.password = password;
        this.plan = plan;
        this.balance = balance;
        this.money = money;
    }

    public void print() {
        DecimalFormat df = new DecimalFormat("#.##");
        System.out.println("注册成功,电话号码:" + phone + ", 用户名:" + name + ", 消费金额:" + money + ", 当前余额:" + df.format(balance));
        plan.print();
    }

    public int getRealFlow() {
        return realFlow;
    }

    public void setRealFlow(int realFlow) {
        this.realFlow = realFlow;
    }


    static Scanner sc = new Scanner(System.in);

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Plan getPlan() {
        return plan;
    }

    public void setPlan(Plan plan) {
        this.plan = plan;
    }

    public double getMoney() {
        return money;
    }

    public void setMoney(double money) {
        this.money = money;
    }

    public double getBalance() {
        return balance;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }

    public int getCallTime() {
        return callTime;
    }

    public void setCallTime(int callTime) {
        this.callTime = callTime;
    }

    public int getMessage() {
        return message;
    }

    public void setMessage(int message) {
        this.message = message;
    }

    public static Scanner getSc() {
        return sc;
    }

    public static void setSc(Scanner sc) {
        User.sc = sc;
    }

    @Override
    public String toString() {
        return "User{" +
                "phone='" + phone + '\'' +
                ", name='" + name + '\'' +
                ", plan=" + plan +
                ", balance=" + balance +
                '}';
    }
}
